using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;

namespace Noein
{
    public class ObjectSystem
    {
        private List<Object> objects = new List<Object>();
        private List<Object> renderableObjects = new List<Object>();

        public void Add(Object obj)
        {
            objects.Add(obj);
            if (obj.Visual != null && obj.Spatial != null)
            {
                renderableObjects.Add(obj);
            }
        }

        public void Update(Device device, float dt)
        {
            foreach (Object obj in objects)
            {
                obj.Update(device, dt);
            }
        }

        public void Render(Device device)
        {
            foreach (Object obj in renderableObjects)
            {
                obj.Render(device);
            }
        }
    }
}
